<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
<title>添加分支机构</title>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/jquery.pagination.js"></script>
<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../js/public.js"></script>
<script type="text/javascript" src="../../js/alert.js"></script>
<script type="text/javascript" src="../../js/loadSchoolGrade.js"></script>
<script type="text/javascript" src="../../js/jquery-ui/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="../../js/jquery-ui/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.css">
</head>
<body>
	<div class="right_mainH4">
		<p>
			添加分支机构 <small>Control panel</small>
		</p>
	</div>
	<div>
		<form id="form1">
			<table class="table table-bordered .table-condensed">
				<tr>
					<td>分支机构编号:</td>
					<td></td>
					<td>培训机构:</td>
					<td id="schools"></td>
				</tr>
				<tr>
					<td>分支机构名称:</td>
					<td>
						<input type="text"  name="name"/>
					</td>
					<td>分支机构地址:</td>
					<td>
						<input type="text" name="address" />
					</td>
				</tr>
				<tr>	
					<td>分支机构负责人:</td>
					<td>
						<input type="text" name="principal" />
					</td>
					<td>负责人联系电话:</td>
					<td>						 
						<input type="text" name="phone" />
					</td>
				</tr>
				<tr>
					
					<td>训练场总面积(㎡):</td>
					<td>
						<input type="text" name="area" />
					</td>
					<td>教练车总数:</td>
					<td>
						<input type="text" name="number" />
					</td>
				</tr>
				<tr>
					<td>分支机构分数:</td>
					<td>
						<input type="text" name="score" />
					</td>
					<td></td>
					<td></td>					
				</tr>
				<tr>
					<td colspan="4" style="text-align: center;">
						<button type="button" onclick="addBranches();" class="btn btn-info">添加</button>
					</td>
				</tr>
			</table>
		</form>
	</div>
	
    <script type="text/javascript">
		$(function(){
			var storage = window.sessionStorage;
		    var schools = storage.getItem("schools");//获取存在sessionStorage里的驾校数据
		    if(schools != null){
		    	var schoolHtml;
		    	schoolHtml = '<select name="addBranches.school" id="school" style="width: 160px;">';
		    	schoolHtml += schools;
		    	schoolHtml += '</select>';
		    	$("#schools").html(schoolHtml);
		    }
		});
		
    	//添加分支机构信息
    	function addBranches(){
    		$.ajax({
    			url : "../../branches/add.ao",
    			type : 'POST',
    			data :$("#form1").serialize(),
    			cache : false,
    			beforeSend : ajaxstar,
    			complete : ajaxend,
    			dataType : "json",
    			success : function(data) {
					sAlert(data["result"]);
    				if(data["state"] == "success"){
    					clearTable("form1");
    				}
    			}
    		});
    	}
 
    </script>
</body>
</html>